import logging

from typing import Literal
from pydantic import BaseModel, Field
logger=logging.getLogger(__name__)
from langgraph.checkpoint.postgres import PostgresSaver
from app.config.llm_client import create_vl_client,create_chat_client
from app.config.database_config import PgManager

class IntendModal(BaseModel):
    intent: Literal["chat", "flight_query", "faq", "shop_recommend", "transport_plan", "__end__"] = Field(
        description="用户的意图，chat: 聊天, flight_query: 查询航班信息, faq: 回答常见问题, shop_recommend: 店铺推荐, transport_plan: 交通规划, __end__: 结束对话")

class EndOfSessionIndent(BaseModel):
    intent: Literal["Y", "N"] = Field(description="会话是否可以结束，Y: 可以结束会话，N: 需要继续会话")

class ImageModel(BaseModel):
    image_path: str = Field(description="图片路径")


class MainAgent:
    def __init__(self, saver: PostgresSaver, pg_manager: PgManager):
        self.llm = create_chat_client()
        self.vm = create_vl_client()  # 用于处理图片识别
        self.pg_manager = pg_manager
        self.saver = saver
        self.workflow = self.create_workflow()
